<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>订餐系统-后台管理</title>
    <link rel="stylesheet" href="/public/home/assets/css/public.css">
    <link rel="stylesheet" href="/public/home/assets/css/login.css">
</head>
<body>
    <table class="login-table">
        <tr>
            <td>
                <div class="login-box">
                    <img src="/public/home/assets/images/logo.png" alt="">
                    <p class="login-title">齐装网点餐系统</p>
                    <b id="msg"></b>
                    <div class="line-box">
                        <label for="">账号 : </label>
                        <input type="text" class="countId" name="countId">
                    </div>
                    <div class="line-box">
                        <label for="">部门 : </label>
                        <input type="text" class="branchId" name="countId">
                    </div>
                    <div class="line-box">
                        <label for="">密码 : </label>
                        <input type="password" class="password" name="password">
                    </div>
                    <div class="line-box">
                        <label for="">重复密码 : </label>
                        <input type="password" class="repassword" name="countId">
                    </div>
                    <div class="line-box">
                        <label for="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </label>
                        <button class="button button-login">注册</button>
                    </div>
                    <p class="to-register">有账号? <a href="{:U('home/public/login')}">点击登陆</a></p>
                </div>
            </td>
        </tr>
    </table>
</body>
<script src="/public/home/assets/js/jquery.min.js"></script>
<script>
    $(function(){
        $('button').click(function(){
            var countId = $('.countId').val();
            var branchId = $('.branchId').val();
            var password = $('.password').val();
            var repassword = $('.repassword').val();
            // 向服务端提交数据
            $.ajax({
                url: "{:U('home/public/register')}",
                type: 'post',
                data: {'username':countId, 'branch':branchId,'password':password,'repassword':repassword},
                success:function(json){
                    $('#msg').html(json.msg)
                    if(json.status == '1') {
                        alert(json.msg)
                        window.location.href = json.url
                    }
                } 
            })
        })
        
    })
</script>
</html>